 /*______________________________________________________________________________
 *
 * Copyright 2005 NORSYS
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * (1) Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 * (2) Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 * (3) The name of the author may not be used to endorse or promote
 *     products derived from this software without specific prior
 *     written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *______________________________________________________________________________
 *
 * Created on 26 sept. 2005
 * Author: Arnaud Bailly
 */
package speculoos.config;

import speculoos.manager.Configure;
import speculoos.manager.MapperConfigurationException;

/**
 * A base interface to configure a manager.
 * This interface may be used by clients to override 
 * default parameters values. A typical configurator 
 * is created from some static data source like an XML file 
 * or a properties file and then passed an instance of 
 * a manager to configure it. 
 * <p /> 
 * This interface offers only generie methods to access parameters. An 
 * implementation is encouraged to add type-safe methods with more meaningful
 * names. The {@link Configurator#addConfigurator(String,Configurator)}
 * method allows implementation of a <em>Chain of Responsibility</em>
 * pattern where this configurator object can delegate configuration 
 * of unknown parameters or element to other, more specialized
 * configurators.
 * </p>
 * <p>
 * Typical usage is within an XML configuration file  analyzer where
 * a configurator can delegate handling of XML fragments to
 * subssytems accordnig to namespaces or tags names.
 * 
 * 
 * @author nono
 * @version $Id: Configurator.java 259 2006-05-23 10:34:50Z /C=FR/ST=Nord/L=Lille/O=Norsys SA/OU=UE/CN=Arnaud Bailly/emailAddress=abailly@norsys.fr $
 */
public interface Configurator {

    /**
     * Adds a subconfigurator to this configurator.
     * 
     * @param name a symbolic name associated with sub-config system. Its
     * meaning is implementation dependant but generally it should be 
     * unique within all subconfigurations in this object.
     * @param subconf a confgurator for a sub-system
     */
    public void addConfigurator(String name, Configurator subconf);
    
	/**
	 * Configure the given manager with the informations stored 
	 * in this configurator.
	 * 
	 * @param conf the manager to configure
	 * @throws MapperConfigurationException if something get 
	 * wrong while configuring the manager
	 */
	public void configure(Configure conf) throws MapperConfigurationException;
	
}
 